/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.bus.service;

import java.util.List;
import java.util.Map;

import com.thinkgem.jeesite.modules.sys.dao.DictDao;
import com.thinkgem.jeesite.modules.sys.entity.Dict;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.bus.dao.VaccineEntDao;
import com.thinkgem.jeesite.modules.bus.entity.VaccineEnt;

/**
 * 疫苗厂家信息表Service
 * @author sy
 * @version 2019-06-14
 */
@Service
@Transactional(readOnly = true)
public class VaccineEntService extends CrudService<VaccineEntDao, VaccineEnt> {
	@Autowired
	private DictDao dictDao;

	public VaccineEnt get(String id) {
		return super.get(id);
	}
	
	public List<VaccineEnt> findList(VaccineEnt vaccineEnt) {
		return super.findList(vaccineEnt);
	}
	
	public Page<VaccineEnt> findPage(Page<VaccineEnt> page, VaccineEnt vaccineEnt) {
		return super.findPage(page, vaccineEnt);
	}
	
	@Transactional(readOnly = false)
	public void save(VaccineEnt vaccineEnt) {
		Dict dict=new Dict();
		dict.setType("vaccineType");
		dict.setValue(vaccineEnt.getVaccineTypeCode());
		vaccineEnt.setVaccineTypeName(dictDao.searchLabelByValue(dict));
		super.save(vaccineEnt);
	}
	
	@Transactional(readOnly = false)
	public void delete(VaccineEnt vaccineEnt) {
		super.delete(vaccineEnt);
	}
	/**
	 *
	 * @Title: validateName
	 * @author: mengying
	 * @date: 2019年06月17日 11:50
	 * @Description: 添加疫苗厂家验证
	 * @param name
	 * @return: Integer
	 */
	public Integer validateName(String name){
		return dao.validateName(name);
	}
	/**
	 *
	 * @Title: validateEditName
	 * @author: mengying
	 * @date: 2019年06月17日 13:32
	 * @Description: 编辑疫苗厂家验证
	 * @param id
	 * @return: String
	 */
	public String validateEditName(String id){
		return dao.validateEditName(id);
	}


	/**
	 * @Author zhangxingliang
	 * @Description  获取所有疫苗厂家
	 * @Date 16:38 2019/6/15
	 **/
	public List<Map<String,Object>> findVaccineEntList() {
		return this.dao.findVaccineEntList();
	}

}